<template>
    <exPubTable ref="jjTable" :cfg.sync="jjcfg" :exData="jjList" @getDataList="queryJJInfo"  :diffHeight="30" :defPageSize="100" :show-summary="true"></exPubTable>
</template>


<script>

export default {
    props:["qry"],
    data() {
        var that =this;
        return {
            totalMoney: 0,
            jjList:[],
            jjcfg:{
                showIndex: true,
                columns: [
                    {prop:"",label:"资金合计(查询全部)",align:"center",
                        columns:[
                            {prop:"tradeno",label:"id",width:160},
                            {prop:"day",label:"日期",width:100,sortable:true},
                            {prop:"code",label:"基金代码",width:100},
                            {prop:"name",label:"基金名称",width:100},
                            {prop:"money",label:"金额",width:120,sumType:"add",formatter:this.fixed2,align:"right",getColor(s){return that.getRateColor(s.row.money)}},
                            // {prop:"remark",label:"备注",width:180},
                            {prop:"createtime",label:"创建日期",width:180,sortable:true},
                        ]
                    }
                ],
            },
        }
    },

    mounted() {
    },
    inject:["getQueryInfo"],

    methods: {
        reQuery(){
            if(this.$refs.jjTable) this.$refs.jjTable.reQuery();
        },
        queryJJInfo(){
            var opername = "getJJInfo";
            this.registerListen(this,opername,(res)=>{
                if(res.succ){
                    this.jjList = res.data;
                }else{
                    this.$message.error("查询异常:"+res.err)
                }
            });

            
            var qry = this.getQueryInfo();
            var where = "";
            var wheres = [];
            if(qry.day && qry.day.egt){
                wheres.push( " day >= " +qry.day.egt)
            }
            if(qry.day && qry.day.elt){
                wheres.push( " day <= " +qry.day.elt)
            }
            if(wheres.length>0){
                where = " where " + wheres.join(" and ");
            }

            var param = {type:opername,name:opername,objInfo:{}};
            param.execSql=true;
            param.sql=`select * from jj ${where} order by day desc`;
            electron.ipcRenderer.send("doSql",param)
        },
    }
    
}
</script>

<style lang="less">

</style>
